function add ( numbers )
    local result = 0    
    for i, v in ipairs ( numbers ) do
        result = result + v
    end
    return result
end

function main ()
    io.write"Hány számot? "
    local numberCount = tonumber ( io.read () )
    if not numberCount or numberCount <= 0 then
        return false
    end
    
    local i = 1
    local numbers = {}
    repeat
        io.write ( i .. ". szám: ")
        local number = io.read ()
        if not tonumber ( number ) then
            return false
        end        
        numbers[ #numbers + 1 ]  = number       
        i = i + 1 
    until i > numberCount
    
    io.write ( add ( numbers ) )
end

main ()